home *** CD-ROM | disk | FTP | other *** search
- /************************************************************
-
- Created: Monday, Sept 23, 1991
- AFPSession.h
- C++ Interface to the AppleTalk Filing Protocol
- M.Vierling
-
-
- Copyright Apple Computer, Inc. 1985-1991
- All rights reserved
-
- ************************************************************/
-
- #ifndef AFPSession_H
- #define AFPSession_H
-
- #include <AppleTalk.h>
- #include "AFPCall.h"
-
- enum {
- afpChangePwd = 36,
- afpGetUserInfo = 37,
- afpGetSrvrMsg = 38, /*AFPCall command codes*/
- afpCreateID = 39, /*AFPCall command codes*/
- afpDeleteID = 40, /*AFPCall command codes*/
- afpResolveID = 41, /*AFPCall command codes*/
- afpExchangeFiles = 42, /*AFPCall command codes*/
- afpCatSearch = 43 /*AFPCall command codes*/
- };
-
- typedef unsigned char PassWord[8];
-
- struct Spec {
-
- Byte length;
- Byte filler;
- char data;
- };
-
- #ifndef __FILES__
- struct CatPositionRec {
-
- long initialize;
- short priv[6];
- };
- #endif
-
- union OSInfo {
-
- char FinderInfo[32];
- struct
- {
- long fdType;
- long fdCreator;
- }fdInfo;
- };
-
- struct FileDirBlock {
-
- short Attributes;
- long ParentDirID;
- long CreateDate;
- long ModDate;
- long BackupDate;
- Byte FinderInfo[32];
- short LongName;
- short ShortName;
- short FileDirFlag;
- union {
- struct {
- long FileNumber;
- long DataLength;
- long RsrcLength;
- } File;
- struct {
- long DirID;
- short OffspringCount;
- long OwnerID;
- long GroupID;
- long AccessRights;
- } Dir;
- };
- short ProDOSFileType;
- long ProDOSAuxType;
- };
-
- AddrBlock FindServer( char * zoneName, char * serverName );
-
- class TAFPSession : public TAFPCall
- {
- public:
- TAFPSession();
- ~TAFPSession();
- OSErr ISession( AddrBlock theAddress );
-
- // Accessors
- AddrBlock GetAddress();
- char * GetAFPVersion();
- char GetPathDelimiter();
- short GetVolumeID();
- short GetForkID();
- short GetIDNum();
- short GetDTRefNum();
- short GetUserID();
- long GetDirID();
- long GetMapID();
- long GetActCount();
- long GetOffset();
- long GetFileID();
- OSErr GetError();
- Ptr GetReply();
-
- // Mutators
- void SetAddress( AddrBlock theAddress );
- void SetPathDelimiter( char delimiter );
- short SetVolumeID( short VolumeID );
- short SetForkID( short OForkRefNum );
- short SetDTRefNum( short DTRefNum );
- short SetUserID( short UserID );
- long SetDirID( long DirID );
- long SetMapID( long MapID );
- long SetFileID( long FileID );
- void SetAFPVersion( char * version );
-
-
- // Server Calls
- OSErr GetSrvrInfo();
- OSErr GetSrvrParms();
- OSErr GetSrvrMsg( short MsgType, short MsgBitmap );
- OSErr LoginGuest();
- OSErr LoginCleartxt( char * UserName, char * Password );
- OSErr LoginRandnum( char * UserName, char * Password );
- OSErr Login2Way( char * UserName, char * Password );
- OSErr Login( char * AFPVersion,
- char * UAM,
- char * UserName,
- char * Password );
- OSErr LoginCont( short IDNumber,
- char * UserAuthInfo,
- char * Password );
- OSErr LoginCont2Way( short IDNumber,
- char * UserAuthInfo,
- char * Password,
- char * UserRandNum );
- OSErr Logout();
- OSErr MapID( long UserID, char FnType );
- OSErr MapName( char * UserName, char FnType );
- OSErr ChangePassword( char * UAM,
- char * UserName,
- char * OldPassword,
- char * NewPassword );
- OSErr GetUserInfo( Byte ThisUserFlag, short, long UserID );
-
-
- // Volume Calls
- OSErr OpenVol( char * VolumeName, char * Password, short Bitmap );
- OSErr CloseVol( short VolumeID );
- OSErr GetVolParms( short VolumeID, short Bitmap );
- OSErr SetVolParms( short VolumeID, short Bitmap, long BackupDate );
- OSErr Flush( short VolumeID );
-
-
- // Directory Calls
- OSErr SetDirParms( short VolumeID,
- long DirID,
- short Bitmap,
- Byte PathType,
- char * Pathname,
- FileDirBlock& theBlock );
- OSErr OpenDir( short VolumeID,
- long DirID,
- Byte PathType,
- char * Pathname );
-
- OSErr CloseDir( short VolumeID, long DirID );
- OSErr Enumerate( short VolumeID,
- long DirID,
- short FileBitmap,
- short DirBitmap,
- short ReqCount,
- short StartIndex,
- short MaxReplySize,
- Byte PathType,
- char * Pathname );
- OSErr CreateDir( short VolumeID,
- long DirID,
- Byte PathType,
- char * Pathname );
-
-
- // File Calls
- OSErr SetFileParms( short VolumeID,
- long DirID,
- short Bitmap,
- Byte PathType,
- char * Pathname,
- FileDirBlock& theBlock );
- OSErr CreateFile( short VolumeID,
- long DirID,
- Byte CreateFlag,
- Byte PathType,
- char * Pathname );
- OSErr CopyFile( short SVolumeID,
- long SDirID,
- Byte SPathType,
- char * SPathname,
- short DVolumeID,
- long DDirID,
- Byte DPathType,
- char * DPathname,
- Byte NewType,
- char * NewName );
- OSErr CreateID( short VolumeID,
- long DirID,
- Byte PathType,
- char * Pathname );
- OSErr DeleteID( short VolumeID, long FileID );
- OSErr ResolveID( short VolumeID,
- long FileID,
- short Bitmap );
- OSErr ExchangeFiles( short VolumeID,
- long SrcDirID,
- long DestDirID,
- Byte SrcPathType,
- char * SrcPathname,
- Byte DestPathType,
- char * DestPathname );
-
-
- // Directory-File Calls
-
- OSErr GetFileDirParms( short VolumeID,
- long DirID,
- short FileBitmap,
- short DirBitmap,
- Byte PathType,
- char * Pathname );
- OSErr SetFileDirParms( short VolumeID,
- long DirID,
- short Bitmap,
- Byte PathType,
- char * Pathname,
- FileDirBlock& theBlock );
- OSErr Rename( short VolumeID,
- long DirID,
- Byte PathType,
- char * Pathname,
- Byte NewType,
- char * NewName );
- OSErr Delete( short VolumeID,
- long DirID,
- Byte PathType,
- char * Pathname );
- OSErr MoveAndRename( short VolumeID,
- long SrcDirID,
- long DestDirID,
- Byte SrcPathType,
- char * SrcPathname,
- Byte DestPathType,
- char * DestPathname,
- Byte NewType,
- char * NewName );
- OSErr CatSearch( short VolumeID,
- long ReqMatches,
- CatPositionRec * CatPosition,
- short FileRsItBitmap,
- short DirRsltBitmap,
- short FPFlag,
- short ReqBitmap,
- FileDirBlock& Spec1,
- FileDirBlock& Spec2,
- char * longName );
-
-
- // Fork Calls -------------------------------------------------------
-
- OSErr GetForkParms( short OForkRefNum,
- short Bitmap );
-
- OSErr SetForkParms( short OForkRefNum,
- short Bitmap,
- long ForkLength );
-
- OSErr OpenFork( Byte RsrcDataFlag,
- short VolumeID,
- long DirID,
- short Bitmap,
- short AccessMode,
- Byte PathType,
- char * Pathname );
-
- OSErr Read( short OForkRefNum,
- long Offset,
- long ReqCount,
- Byte NewlineMask,
- Byte NewlineChar,
- char * buffer );
-
- OSErr Write( short OForkRefNum,
- long Offset,
- long ReqCount,
- Byte StartEndFlag,
- char * buffer );
-
- OSErr FlushFork( short OForkRefNum );
-
- OSErr ByteRangeLock( Byte StartEndFlag,
- short OForkRefNum,
- long Offset,
- long Length );
-
- OSErr CloseFork( short OForkRefNum );
-
-
-
- // Desktop Calls ---------------------------------------------------
-
- OSErr OpenDT( short VolumeID );
- OSErr CloseDT( short DTRefNum );
- OSErr AddIcon( short DTRefNum,
- ResType FileCreator,
- ResType FileType,
- Byte IconType,
- ResType IconTag,
- short BitmapSize,
- Ptr IBitmapPtr );
- OSErr GetIcon( short DTRefNum,
- ResType FileCreator,
- ResType FileType,
- Byte IconType,
- short Length );
- OSErr GetIconInfo( short DTRefNum,
- ResType FileCreator,
- short IconIndex );
- OSErr AddAPPL( short DTRefNum,
- long DirID,
- ResType FileCreator,
- ResType APPLTag,
- short PathType,
- char * Pathname );
- OSErr RemoveAPPL( short DTRefNum,
- long DirID,
- ResType FileCreator,
- short PathType,
- char * Pathname );
- OSErr GetAPPL( short DTRefNum,
- ResType FileCreator,
- short APPLIndex,
- short Bitmap );
- OSErr AddComment( short DTRefNum,
- long DirID,
- Byte PathType,
- char * Pathname,
- char * Comment );
- OSErr RemoveComment( short DTRefNum,
- long DirID,
- Byte PathType,
- char * Pathname );
- OSErr GetComment( short DTRefNum,
- long DirID,
- Byte PathType,
- char * Pathname );
-
- private:
- AddrBlock fafpAddrBlock;
- char fAFPVersion[17];
- char fPathDelimiter;
- unsigned short fCBSize,
- fRBSize;
- short fVolumeID;
- short fOForkRefNum;
- short fDTRefNum;
- long fDirID;
- long fMapID;
- long fFileID;
- long fActCount;
- long fOffset;
- Ptr fCBptr,
- fRBptr;
- Ptr fCBStart;
- Ptr fRBStart;
-
- void bytePush( Byte aByte );
- void shortPush( short theShort );
- void longPush( long theLong );
- void stringPush( char * stringName );
- void passwordPush( char * Password );
- void passwordCreate( PassWord * password, char * string );
- void desPush( PassWord * Key, PassWord * Password, Boolean useNewDES );
- void fileDirPush( short Bitmap, FileDirBlock& theBlock );
- void specPush( short Bitmap, FileDirBlock& theBlock, char * string );
- void pathPush( Byte PathType, char * Pathname );
- void arrayPush( char * arrayName, unsigned int arrayLen );
- void alignPush();
- OSErr MakeAFPCall();
- };
-
- #endif